/**
 * Copyright 2006 Brad Reynolds
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.leeloo.databinding.internal.ui;

import junit.framework.TestCase;

import org.eclipse.jface.databinding.BindingEvent;

public class DatabindingTest extends TestCase {
    public void testGetBindingEventName() throws Exception {
        assertEquals("EVENT_COPY_TO_TARGET", Databinding.getBindingEventName(BindingEvent.EVENT_COPY_TO_TARGET));
        assertEquals("EVENT_COPY_TO_MODEL", Databinding.getBindingEventName(BindingEvent.EVENT_COPY_TO_MODEL));
        assertEquals("EVENT_PARTIAL_VALIDATE", Databinding.getBindingEventName(BindingEvent.EVENT_PARTIAL_VALIDATE));
        assertEquals("EVENT_REMOVE", Databinding.getBindingEventName(BindingEvent.EVENT_REMOVE));
        assertEquals("EVENT_LAZY_DELETE", Databinding.getBindingEventName(BindingEvent.EVENT_LAZY_DELETE));
        
        try {
            Databinding.getBindingEventName(-1);
        } catch (IllegalArgumentException e) {
        }
        
        try {
            Databinding.getBindingEventName(100);
        } catch (IllegalArgumentException e) {
        }
    }
    
    public void testGetPipelinePositionName() throws Exception {
        assertEquals("PIPELINE_AFTER_GET", Databinding.getPipelinePositionName(BindingEvent.PIPELINE_AFTER_GET));
        assertEquals("PIPELINE_AFTER_VALIDATE", Databinding.getPipelinePositionName(BindingEvent.PIPELINE_AFTER_VALIDATE));
        assertEquals("PIPELINE_AFTER_CONVERT", Databinding.getPipelinePositionName(BindingEvent.PIPELINE_AFTER_CONVERT));
        assertEquals("PIPELINE_AFTER_BUSINESS_VALIDATE", Databinding.getPipelinePositionName(BindingEvent.PIPELINE_AFTER_BUSINESS_VALIDATE));
        assertEquals("PIPELINE_AFTER_CHANGE", Databinding.getPipelinePositionName(BindingEvent.PIPELINE_AFTER_CHANGE));
        assertEquals("PIPELINE_VALIDATION_ERROR_OR_WARNING", Databinding.getPipelinePositionName(BindingEvent.PIPELINE_VALIDATION_ERROR_OR_WARNING));
        
        try {
            Databinding.getPipelinePositionName(-1);
        } catch (IllegalArgumentException e) {
        }
        
        try {
            Databinding.getPipelinePositionName(100);
        } catch (IllegalArgumentException e) {
        }
    }
}
